package com.smh.aiagent.agent;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author shiminghui
 * @date 2025/6/8 15:31
 * @description: 思考行动智能体
 */
@EqualsAndHashCode(callSuper = true)
@Data
public abstract class ReactAgent extends BaseAgent {

    /**
     * 思考
     *
     * @return 思考结果(是否要有行动)
     */
    protected abstract boolean think();

    /**
     * 执行动作
     *
     * @return 动作结果
     */
    protected abstract String action();


    @Override
    protected String getNextStep() {
        boolean shouldAction = think();
        if (!shouldAction) {
            return "思考结束,不需要有行动";
        }
        return action();
    }
}
